package teamproject.visualization.gui;

import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Vector3d;

/**
 * Creates a TransformGroup object that scales a Shape3D object in the scene.
 */
public class Scaler implements TransformGroupGenerator {

	private TransformGroup tg;
	private Vector3d scaleVector;

	/**
	 * 
	 * @param x
	 *            the x coordinate of the scale vector
	 * @param y
	 *            the y coordinate of the scale vector
	 * @param z
	 *            the z coordinate of the scale vector
	 */
	public Scaler(float x, float y, float z) {
		scaleVector = new Vector3d(x, y, z);
		tg = new TransformGroup();
	}

	@Override
	public TransformGroup getTransformGroup() {
		tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
		Transform3D transform = new Transform3D();
		transform.setScale(scaleVector);
		tg.setTransform(transform);

		return tg;
	}
}
